package cn.scau.server.utils;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.scau.server.vo.EmpPermissionVO;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class MobileUserutils {
    public static String generateToken() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    public static Map<String, Object> empToMap(EmpPermissionVO emp) {
        return BeanUtil.beanToMap(emp, new HashMap<>(),
                CopyOptions.create()
                        .setIgnoreNullValue(true)
                        .setFieldValueEditor((fieldName, fieldValue) -> fieldValue.toString())
        );
    }
}
